package pers.zc.activiti.aop.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import pers.zc.activiti.aop.testDemo.TestAnno;
import pers.zc.activiti.thread.pool.ThreadPool;

import java.util.concurrent.Callable;

/**
 * @description 测试1
 * @Author Lin FuYuan
 * @date 2020/6/9
 */
@Service
public class TestOne implements TestAop{
    @Autowired
    private ThreadPool threadPool;
    @Override
    public Boolean test(){
        ThreadPoolTaskExecutor threadPoolTaskExecutor = threadPool.testThreadPool();
        Runnable runnable = () -> go();
        Callable<Boolean> callable = () -> go();
        threadPoolTaskExecutor.execute(() ->{
            try {
                go();
            } catch (Exception e) {

            }
        });

        return true;
    }

    private void check(Boolean go) {
        try {
            //执行方法
        } catch (Exception e) {
            //异常
        }
        //返回结果
    }

    @TestAnno("hdfs/one")
    public Boolean go(){
        System.out.println("go");
        return true;
    }


    public static void main(String[] args) {
        TestOne one = new TestOne();
        one.test();
    }

}
